package zk.akuser.singleton.lazy;

/**
 * 双重检查实现单例模式：懒汉式
 *
 * @author akuser 2022年3月11日 下午7:25:07
 * @version 1.0
 */
public class LazyLoadingSingletonByDoubleCheck {
    private static volatile LazyLoadingSingletonByDoubleCheck instance = null;

    private LazyLoadingSingletonByDoubleCheck() {
        super();
    }

    public static LazyLoadingSingletonByDoubleCheck getInstance() {
        if (instance == null) {
            synchronized (LazyLoadingSingletonByDoubleCheck.class) {
                if (instance == null) {
                    instance = new LazyLoadingSingletonByDoubleCheck();
                }
            }
        }
        return instance;
    }
}
